<!DOCTYPE html>
<html>

<head>
    <#include "/zf/admin/components/meta.html" />
    <title>蓁奕科技 ${metaTitleSuffix!}</title>
    <#include "/zf/admin/components/stylesheets.html" />
</head>

<body>
    <div id='app'>
        <el-container>
            <#assign menuIndex="1-1" />
            <#include "/zf/admin/components/menu.html" />
            <el-container>
                <#include "/zf/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-date-picker v-model="dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" unlink-panels="true" :default-value="new Date">
                            </el-date-picker>
                         <el-input v-model="keyword" clearable placeholder="关键字搜索" style="width: 217px;"></el-input>
                             <el-select  v-model="type" clearable filterable placeholder="类型">
                                 <el-option :value="0" label="建议"></el-option>
                                <el-option :value="1" label="投诉"></el-option>
                                <el-option :value="2" label="反馈"></el-option>
                            </el-select>
                            <el-button   @click="onSearch"><i class="el-icon-search"></i>搜索</el-button>
                        <el-table :data="items" style="width: 100%">
                       
                            <!-- <el-table-column prop="id" label="id">
                            </el-table-column> -->
                            <el-table-column prop="nickName" label="微信名">
                            </el-table-column>
                            <el-table-column prop="type" label="类型">
                            <template slot-scope="scope">
                                    <span v-if='scope.row.type ==0'>建议</span>
                                    <span v-if='scope.row.type ==1'>投诉</span>
                                    <span v-if='scope.row.type ==2'>反馈</span>
                                </template>
                             </el-table-column>
                    
                            <el-table-column  :show-overflow-tooltip="true" prop="content" label="内容" >
                            </el-table-column>
                              <el-table-column >
                                <template slot-scope="scope">
                                    <el-button type="text" @click="selectMore(scope.row)">查看更多</el-button>                 
                                </template>
                            </el-table-column>
                              <el-table-column prop="addTime" label="提交时间">
                            </el-table-column>
                          
                              <el-table-column prop="isReplied" label="状态">
                                  <template slot-scope="scope">
                                    <span v-if='scope.row.isReplied ==0'>未回复</span>
                                    <span v-if='scope.row.isReplied ==1'>已回复</span>                         
                                </template>
                            </el-table-column>
                              <el-table-column :show-overflow-tooltip="true" prop="replyContent" label="回复内容">               
                            </el-table-column>
                             <el-table-column >
                                <template slot-scope="scope">
                                    <el-button type="text" @click="showReply(scope.row)">查看更多</el-button>  
                                </template>
                            </el-table-column>
                             <el-table-column prop="replyTime" label="回复时间">
                            </el-table-column>
                            <el-table-column  label="操作">
                                <template slot-scope="scope">
                                   <el-button type="textarea" v-if='!scope.row.replyContent'  @click="open(scope.row)">回复</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <#include '/components/page.html' />
                          <el-dialog  title="内容"  :visible.sync="contentdialogVisible" width="30%">
                                       <!-- <span v-html=''>{{replyContent}}</span> -->
                                       <span v-html='Content'></span>
                                     <span slot="footer" class="dialog-footer">
                                       <el-button @click="contentdialogVisible = false">取 消</el-button>
                                       <el-button type="primary" @click="contentdialogVisible = false">确 定</el-button>
                                    </span>
                          </el-dialog>
                         <el-dialog  title="回复内容"  :visible.sync="dialogVisible" width="30%">
                                       <!-- <span v-html=''>{{replyContent}}</span> -->
                                       <span v-html='replyContent'></span>
                                     <span slot="footer" class="dialog-footer">
                                       <el-button @click="dialogVisible = false">取 消</el-button>
                                       <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                                    </span>
                         </el-dialog>
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/zf/admin/components/footer.html" />
    </div>
    <#include "/zf/admin/components/scripts.html" />
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                 dateRange: '',
                items: toJson(`${items![]}`),
                type: '${type!}' ? Number('${type!}') : '' ,
                 keyword:'${keyword!}',
                 dialogTableVisible: false,
                 dialogVisible: false,
                contentdialogVisible: false,
               replyContent:'',
                Content:'',

            }
        },
        mounted: function() {
              var str = trimStrBr('replyContent')
              var startTime = '${startTime!""}'
             if (startTime != '') {
                this.dateRange = new Array;
                this.dateRange.push('${startTime!}');
                this.dateRange.push('${endTime!}');
            }
        },
        methods: {
            onSearch() {
                var self = this;
                var keys = [  
                 { key: 'andTime', value: self.andTime },
                    { key: 'type', value: self.type },
                    { key: 'keyword', value: self.keyword}
                ]
                if (self.dateRange != null && self.dateRange.length > 1) {
                    keys.push({ key: 'startTime', value: self.dateRange[0] });
                    keys.push({ key: 'endTime', value: self.dateRange[1] });
                } else {
                    keys.push({ key: 'startTime', value: '' });
                    keys.push({ key: 'endTime', value: '' });
                }
                goPage(1, keys);
            },
            selectMore(info) {
               this.contentdialogVisible = true;
               this.Content = trimStrBr(info.content);
        },
             showReply(info) {
                this.dialogVisible = true;
                this.replyContent = trimStrBr(info.replyContent);
             },
      //    handleClose(done) {
      //   this.$confirm('确认关闭？')
      //     .then(_ => {
      //       done();
      //     })
      //     .catch(_ => {});
      // }
    
        //查看回复更多
          //  selectReMore(info) {

          //     this.$alert(info.replyContent,'内容' ,{
          //     confirmButtonText: '确定',
          //    callback: action => {
    
          //    }
          // });
       // }
          //  ,
             // this.$router.replace({path:'/zf/admin/comment/info?commentId=' + info.id+'&replyContent='+value})
              open(info) {
                this.$prompt('输入回复', '回复', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  inputType:'textarea'
                }).then(({ value }) => {
             if(value!=null){
                var param = {
                   commentId: info.id,
                   replycontent:value
                }
              axiosRequest(param, '/zf/admin/comment/info','/zf/admin/comment/list')
          // this.$router.replace({path:'/zf/admin/comment/info?commentId=' + info.id+'&replyContent='+value})
           }
           else{
                   msg("没有输入回复内容");
           }
        })
        // .catch(() => {
        //   this.$message({
        //     type: 'info',
        //     message: '取消输入'
        //   });       
        // });
      
      }
            
        }
    })
    </script>
</body>

</html>